package com.qiqidream.admin.system.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qiqidream.admin.system.model.entity.Department;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 系统管理-部门表  Mapper 接口
 * @author QiQiDream
 * @since 2019/11/18 10:53
 */
public interface DepartmentMapper extends BaseMapper<Department> {

    @Select("SELECT id FROM sys_department, ( SELECT @pid := #{parentId} ) initial WHERE FIND_IN_SET( parent_id, @pid ) > 0 AND @pid := concat( id, ',', @pid )")
    List<Long> getChildrenId(Long parentId);
}
